<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/WEB-INF/pages/common/taglibs.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="${ctx}resources/css/screen.css" /> 
<link rel="stylesheet" type="text/css" href="${ctx}resources/css/list.css" />
<script type="text/javascript" src="${ctx}resources/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="${ctx}resources/js/messages_cn.js"></script> 
<title>用户角色编辑管理页面</title>
</head>
<script type="text/javascript">
$().ready(function() {
	$("#name").val("");
	$("#signupForm").validate({
		rules: {
			name: {
				required: true
					　 }
		},
		messages: {
			name: {
				required: "角色名不能为空！"
		}
	}});
}); 
</script>
<body>
<div style="margin: 0px; padding-top:20px; ">
	<form action="${ctx}role/modify.htm" id="signupForm" method="post">
	<input type="hidden" value="${role.id}" name="id">
	<input type="hidden" value="${pageNo}" name="pageNo">
<table width="95%" cellpadding="0" cellspacing="1" align="center" id="bordertable">
    <tr class="tr1" height="40">
			<td align="right" width="40%">角色名:</td>
			<td align="left" width="60%"><input class="input" type="text"  value="${role.name}" name="name"></td>
	</tr>
    <tr class="tr0" height="40">
       <td align="right" width="40%">
				状&nbsp;&nbsp;&nbsp;&nbsp;态:
			</td>
			<td align="left" width="60%">
			<select name="enabled" class="input">
				<option value="1" ${role.enabled?"selected":""}>正常 </option>
		 		<option value="0" ${role.enabled?"":"selected"}>禁用</option>
			</select>
			</td>
	</tr>
    <tr class="tr0" height="60">
			<td align="right" width="40%">权&nbsp;&nbsp;&nbsp;&nbsp;限:</td>
			<td align="left" width="60%">
				<c:forEach items="${auths}" var="auth" varStatus="rowCounter">
					<c:set var="isDoing" value="0" />
		      	<c:forEach items="${role.authorities}" var="auth1">
		      	     <c:if test="${auth eq auth1}">
			         	<input type="checkbox" checked="checked" name="auth" value="${auth1.id}"> ${auth1.name}
			           	<c:set var="isDoing" value="1"/>
			         </c:if>
		      	</c:forEach>
		           	<c:if test="${isDoing!=1}">
		            	 <input type="checkbox" name="auth" value="${auth.id}"> ${auth.name}
		           	</c:if>
		           	<c:if test="${rowCounter.index % 4 == 0}">
		       		<br/>
		      		</c:if> 
				</c:forEach></td>
	</tr>
  <tr height="60px;"  class="tr0">
			<td style="padding-right: 20px;text-align: right;"><input class="button" type="submit" value="提交"/></td>
			<td  style="padding-left: 20px;text-align: left;"><input class="button"  type="reset" value="取消" onclick="javascript:history.back();"/></td>
		</tr>
</table>
	</form>
</div>
</body>

</html>